package com.wl.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author wangLin
 * @version 1.0
 * @projectName SpringMVC
 * @className IndexController
 * @date 2021-04-29 周四
 * @time 20:24
 *
 * @description TODO
 */

@Controller
public class IndexController {

//    @ResponseBody
//    @RequestMapping(value="/index",produces = "application/json; charset=utf-8")
    @RequestMapping("/index")
    public ModelAndView index() {
        String name="王林";
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = simpleDateFormat.format(date.getTime());
        ModelAndView view = new ModelAndView("index","myInfo",name+"<br>"+time);
        return view;
    }

}
